package com.ruoyi.web.core.config;

import com.ruoyi.by.health.domain.entity.ByhealthEmployee;
import com.ruoyi.by.health.service.IByhealthEmployeeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

@Component
public class ByhealthSystemConfigInitConfig {

    @Resource

    RedisTemplate<String, Object> redisTemplate;
    private static final Logger log = LoggerFactory.getLogger(ByhealthSystemConfigInitConfig.class);

    @PostConstruct
    public void initGameScoreRegion() {
        log.info("----开始初始化系统配置-----");
        redisTemplate.opsForHash().put("byhealth_system_config", "showVote", true);
        redisTemplate.opsForHash().put("byhealth_system_config", "showPrize", true);
        redisTemplate.opsForHash().put("byhealth_system_config", "showSeat", true);
        redisTemplate.opsForHash().put("byhealth_system_config", "showRule", true);
        redisTemplate.opsForHash().put("byhealth_system_config", "canVote", false);
        redisTemplate.opsForHash().put("byhealth_system_config", "gameEndTime", LocalDateTime.parse("2024-01-18 15:00:00",
                java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));

        log.info("----初始化系统配置到redis完成-----");
    }

}
